﻿@inherits BasePage
@page "/User/List"

<TableGroup>
    <Table TItem="UserModel" ShowLoading="true"
           ShowToolbar="true" ShowDefaultButtons="true" ShowAddButton="true"
           ShowExtendButtons="true" ShowEditButton="true" ShowDeleteButton="true"
           OnSaveAsync="OnSaveAsync" OnDeleteAsync="OnDeleteAsync"
           ShowSearch="true" ShowAdvancedSearch="false" ShowRefresh="true" IsStriped="true" IsBordered="true" ShowLineNo="true"
           IsPagination="true" OnQueryAsync="@OnQueryAsync">
        <TableColumns>

            <TableColumn @bind-Field="@context.Number" />
            <TableColumn @bind-Field="@context.Name" />
            <TableColumn @bind-Field="@context.No" />
            <TableColumn @bind-Field="@context.IsEnabled" ComponentType="@typeof(Switch)" />
            <TableColumn @bind-Field="@context.DeptName">
                <EditTemplate Context="value">
                    <div class="col-12 col-sm-6">
                        <SelectDept @bind-Value="(((UserModel)value).DeptId)" DisplayText="部门" />
                        <ValidationMessage For="()=>context.DeptId" />
                    </div>
                </EditTemplate>
            </TableColumn>
            <TableColumn @bind-Field="@context.UserRoleNames" Text="角色">
                <EditTemplate Context="value">
                    <div class="col-12 col-sm-6">
                        <SelectRole @bind-Value="@(((UserModel)value).UserRoleIds)"></SelectRole>
                    </div>
                </EditTemplate>
            </TableColumn>
            <TableColumn @bind-Field="@context.PortraitRoutePictureId" Text="头像">
                <EditTemplate Context="value">
                    <div class="col-12 col-sm-6">
                        <InputUploadPicture  @bind-Value=@value.PortraitRoutePictureId></InputUploadPicture>
                    </div>
                </EditTemplate>
                <Template Context="value">
                    <PictrueThumbs PictureId=value.Value></PictrueThumbs>
                </Template>
            </TableColumn>
            <TableColumn @bind-Field="@context.FileId" Text="文件">
                <EditTemplate Context="value">
                    <div class="col-12 col-sm-12">
                        <InputUploadFile  ShowDeleteButton=true ShowLabel=true @bind-Value=@value.FileId ></InputUploadFile>
                    </div>
                </EditTemplate>
                  <Template Context="value">
                    <FileThumbs Value=value.Value></FileThumbs>
                </Template>
                
            </TableColumn>
        </TableColumns>
        <RowButtonTemplate Context="obj">
            <BootstrapBlazor.Components.PopConfirmButton Size="Size.ExtraSmall" Icon="fa fa-info-circle" Color="Color.Info" Content="您确定要将密码重置为[123456]？" Text="重置密码" OnConfirm="@ResertAsync"></BootstrapBlazor.Components.PopConfirmButton>
        </RowButtonTemplate>
    </Table>
</TableGroup>

